<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>活动列表</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<link href="css/app.css" rel="stylesheet" />

		<script src="js/mui.min.js"></script>
		<script src="js/app.js"></script>
		<script src="js/config.js"></script>
		<script src="js/jquery-1.7.1.min.js"></script>
		<script src="js/jquery.blockUI-2.3.3.js"></script>

		<style>
			#pspan {
				word-break: break-word;
				word-wrap: break-word;
			
			}
		</style>

	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">活动列表</h1>
			<a class="mui-btn mui-btn-link mui-btn-nav mui-pull-right" onclick="logOut()">
				注销
			</a>
		</header>
		<div class="mui-content" id="showContent">
			<ul class="mui-table-view">

			</ul>
			

		</div>
		<script>
			mui.init();
			
			function logOut() {
				var storage = window.localStorage;  
				storage.clear();
				window.location = "index.html"
			}
			
			function goJob(value,status){
				if(status == 0){
						window.location.href = "loveJob.html?id="+value;
				}else{
					window.location.href = "loveJobreadonly.html?id="+value;
				}
				
				
			}
			
			
			$(function() {
				var data = {
					"param": '{"account":"account"}'
				};
				//调用接口解析数据并遍历
				$.ajax({
					url: urlAdd + '/mobile/title',
					type: 'post',
					data: data,
					dataType: 'json',
					timeout: 10000,
					async: false,
					crossDomain: true,
					beforeSend: function() { //这里是开始执行方法，显示效果
						var Pwidth = document.body.clientWidth + "px";
						var Pheight = document.body.clientHeight + "px";
						$.blockUI({
							overlayCSS: {
								backgroundColor: 'gainsboro',
								opacity: '1',
								width: '' + Pwidth,
								heigh: '' + Pheight,
							},
							message: "<img src='images/wait.gif' style='vertical-align: text-top;vertical-align: middle;'><span style='vertical-align: middle;margin-left:10px;'>加载中...</span>",
							timeout: 10000,
							css: {
								position: 'absolute',
								left: '30%',
								top: '35%',
								width: '50%',
								heigh: '10%',
								border: '0px',
								background: 'none'
							}
						});
					},
					complete: function() { //方法执行完毕，效果自己可以关闭
						$.unblockUI();
					},
					success: function(data) {
						if (data == false) {
							mui.toast('暂无活动！');　
						} else {
							$.each(data, function(i, item) {
								var itemName = "";
								if (item.status == 0) {
									itemName = "进行中";
								} else if (item.status == 1) {
									itemName = "准备中";
								} else if (item.status == 2) {
									itemName = "已结束";
								}
								$(".mui-table-view").append("<li class='mui-table-view-cell'><a class='mui-navigate-right' href='#' onclick='goJob("+item.id+","+item.status+")' >" + item.titleTime + "&nbsp;&nbsp;&nbsp;&nbsp;" + itemName + "<p>" + item.name + "</p></a></li>");
							
							})
						}
					},
					error: function(data) {
						mui.toast('系统繁忙，请稍后再试！');
					}
				});
			});
		</script>

	</body>

</html>